#ifndef GRAPHICSTEXT_H
#define GRAPHICSTEXT_H

#include <QGraphicsTextItem>

class GraphicsText : public QGraphicsTextItem
{
	Q_OBJECT

public:
	enum { Type = UserType + 1};

	GraphicsText( QGraphicsItem *parent = 0 );
	GraphicsText( const QString& text, QGraphicsItem *parent = 0 );
	~GraphicsText();
	void setAlignment( Qt::Alignment );
	void setEditable(bool);
	virtual int type() const;
	
public slots:
	void updateGeometry();

protected:
	void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
	void focusOutEvent ( QFocusEvent * );
	void keyPressEvent ( QKeyEvent * );
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

private:
	Qt::Alignment _alignment;
	bool _isEditable;
	void init();

friend class GateItem;
};

#endif // GRAPHICSTEXT_H
